<div ng-controller="chainGoodsAddCtrl">
    <div class="bg-light lter b-b wrapper-md ng-scope">
        <h4 class="m-n font-thin">商品导入</h4>
        <button ui-sref="app.goods" class="btn-back btn btn-dark btn-sm btn-rounded">
            返回
        </button>
        </div>
    <div class="wrapper">
        <div class="panel-body panel">
            <div class="panel-body bg-light">
                <div class="panel-body panel text-center">
                    <span class="block m-b-sm">导入连锁商品步骤<i class="m-l-xs fa fa-question-circle text-muted pos-rlt h6" popover-placement="top" popover="连锁商品添加步骤" popover-trigger="mouseenter">
                    </i></span>
                    <div class="inline">
                        <div class="text-center pull-left">
                            <div class="step-bar step-bar-after">
                                <div class="step-dot">1</div>
                            </div>
                            <span class="step-text">查询商品</span>
                        </div>
                        <div class="text-center pull-left">
                            <div class="step-bar step-bar-before step-bar-after">
                                <div class="step-dot">2</div>
                            </div>
                            <span class="step-text">选择连锁商品</span>
                        </div>
                        <div class="text-center pull-left">
                            <div class="step-bar step-bar-before">
                                <div class="step-dot">3</div>
                            </div>
                            <span class="step-text" ng-click="openPopup()">导入商品</span>
                        </div>
                    </div>
                </div>

                <div class="panel-body panel m-n">
                    <div class="m-b">
                        <form class="form-inline ng-pristine ng-valid">
                            <div class="form-group">
                                <label class="control-label">商品名称</label>
                                <input type="text" class="input-sm form-control" ng-model="chainGoodsListVO.name" placeholder="商品的名称">
                            </div>
                            <button class="btn btn-sm btn-default" ng-click="findPageAll()">查询</button>
                        </form>
                    </div>
                    <div>
                        <table class="table table-striped b-t b-light pos-rlt m-n">
                            <thead>
                                <tr>
                                    <th width="20">
                                        <label class="i-checks i-checks-sm m-b-none">
                                            <input type="checkbox" ng-checked="isCheckedAll()" ng-click="checkAll($event)"><i></i>
                                        </label>
                                    </th>
                                    <th>图片/详情</th>
                                    <th>库存</th>
                                    <th>品牌</th>
                                    <th>系统类型</th>
                                    <th>服务类型</th>
                                    <th>让利值(%)</th>
                                    <th>SKU</th>
                                    <th>推荐</th>
                                    <th>分销</th>
                                    <th>返利</th>
                                    <th width="100">操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr ng-repeat="item in list">
                                    <td><label class="i-checks i-checks-sm m-b-none"><input type="checkbox" name="post[]" ng-checked="isChecked(item)" ng-click="updateSelection($event,item)"><i></i></label></td>
                                    <td width="400">
                                        <div class="inline">
                                            <img src="img/default.png" ng-src="{{app.image.chainGoods}}{{item.fileName}}" err-src="img/error.png" class="pull-left inline m-r" style="height: 60px;width: 60px;">
                                            <div class="pull-left">
                                                <span class="font-bold block m-b-xs text-ellipsis">{{item.name}}</span>
                                                <p class="block h6 m-b-xs">商品类型:{{item.typeName}}</p>
                                                <p class="h6 m-b-xs" ng-if="item.isOpenSku==0">单价:{{item.price | number:2}}元</p>
                                                <p class="h6 m-b-xs" ng-if="item.isOpenSku==1">单价范围:{{item.skuRangePrice | number:2}}元</p>
                                                <del class="text-muted block">参考价:{{item.referencePrice|number:2}}元</del>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <div>
                                            <span>{{item.stock}}</span>
                                        </div>
                                    </td>
                                    <td>
                                        <div>
                                            <span>{{item.brandName}}</span>
                                        </div>
                                    </td>
                                    <td>
                                        <div>
                                            <span>{{item.systemType}}</span>
                                        </div>
                                    </td>
                                    <td>
                                        <p ng-if="item.type==0" class="label bg-success h6">到店</p>
                                        <p ng-if="item.type==1" class="label bg-warning h6">配送</p>
                                        <p ng-if="item.type==2" class="label bg-info h6">直邮</p>
                                        <p ng-if="item.type==3" class="label bg-primary h6">堂食</p>
                                        <p ng-if="item.type==4" class="label bg-danger h6">预定</p>
                                        <p ng-if="item.type==5" class="label bg-danger h6">积分</p>
                                    </td>
                                    <td>
                                        <div>
                                            <span>{{item.profit}}</span>
                                        </div>
                                    </td>
                                    <td>
                                        <span class="label bg-light" ng-class="{0:'bg-light',1:'bg-success'}[item.isOpenSku]" ng-bind="{0:'未开启',1:'已开启'}[item.isOpenSku]"></span>
                                    </td>
                                    <td>
                                        <span class="label bg-light" ng-class="{0:'bg-light',1:'bg-success'}[item.isRecommend]" ng-bind="{0:'未推荐',1:'已推荐'}[item.isRecommend]"></span>
                                    </td>
                                    <td>
                                        <span class="label bg-light" ng-class="{0:'bg-light',1:'bg-success'}[item.isOpenSell]" ng-bind="{0:'未开启',1:'已开启'}[item.isOpenSell]"></span>
                                    </td>
                                    <td>
                                        <span class="label bg-light" ng-class="{0:'bg-light',1:'bg-success'}[item.isOpenRebate]" ng-bind="{0:'未开启',1:'已开启'}[item.isOpenRebate]"></span>
                                    </td>
                                    <td>
                                        <button class="btn btn-sm btn-success" ng-click="importGoods(item.id)" ng-if="!importState">导入</button>
                                        <button class="btn btn-sm btn-success" ng-click="importGoods(item.id)" ng-if="importState" disabled><i class="fa fa-spin fa-refresh"></i></button>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <div ng-if="list.length<=0 && !app.loading" class="padder-v text-center">
                            <span class="h6">~未搜索到任何数据~</span>
                        </div>
                        <div>
                            <circle-loading ng-if="app.loading"></circle-loading>
                        </div>
                        <footer class="panel-footer">
                            <div class="row">
                                <div class="col-sm-4 hidden-xs">
                                    <button class="btn btn-sm btn-default" ng-click="batchImportGoods()" ng-if="!batchImportStatus">批量导入</button>
                                    <button class="btn btn-success" ng-if="batchImportStatus" disabled><i class="fa fa-spin fa-refresh m-r-xs"></i>正在批量导入</button>
                                </div>
                                <div class="col-sm-4 text-center">
                                    <small class="text-muted inline m-t-sm m-b-sm">显示第 {{startRow}} 至 {{endRow}} 项结果，共 {{totalItems}} 项</small>
                                </div>
                                <div class="col-sm-4 text-right text-center-xs">
                                    <pagination boundary-links="true" total-items="totalItems" ng-model="currentPage"
                                                ng-change="pageChanged()" max-size="{{maxPageRow}}" class="pagination-sm m-t-none m-b"
                                                previous-text="上一页" next-text="下一页"
                                                first-text="首页" last-text="尾页"></pagination>
                                </div>
                            </div>
                        </footer>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>